<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_Typegovernera extends Application_Model_ModelAbstract
{

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_Idtypegovernera;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_Nomenclature;



    /**
     * Dependent relation fk_governeras_typegovernera1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Governeras
     */
    protected $_Governeras;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idtypegovernera'=>'Idtypegovernera',
            'nomenclature'=>'Nomenclature',
        ));

        $this->setParentList(array(
        ));

        $this->setDependentList(array(
            'FkGovernerasTypegovernera1' => array(
                    'property' => 'Governeras',
                    'table_name' => 'Governeras',
                ),
        ));
    }

    /**
     * Sets column idtypegovernera
     *
     * @param string $data
     * @return Application_Model_Typegovernera
     */
    public function setIdtypegovernera($data)
    {
        $this->_Idtypegovernera = $data;
        return $this;
    }

    /**
     * Gets column idtypegovernera
     *
     * @return string
     */
    public function getIdtypegovernera()
    {
        return $this->_Idtypegovernera;
    }

    /**
     * Sets column nomenclature
     *
     * @param text $data
     * @return Application_Model_Typegovernera
     */
    public function setNomenclature($data)
    {
        $this->_Nomenclature = $data;
        return $this;
    }

    /**
     * Gets column nomenclature
     *
     * @return text
     */
    public function getNomenclature()
    {
        return $this->_Nomenclature;
    }

    /**
     * Sets dependent relations fk_governeras_typegovernera1
     *
     * @param array $data An array of Application_Model_Governeras
     * @return Application_Model_Typegovernera
     */
    public function setGoverneras(array $data)
    {
        $this->_Governeras = array();

        foreach ($data as $object) {
            $this->addGoverneras($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_governeras_typegovernera1
     *
     * @param Application_Model_Governeras $data
     * @return Application_Model_Typegovernera
     */
    public function addGoverneras(Application_Model_Governeras $data)
    {
        $this->_Governeras[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_governeras_typegovernera1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Governeras
     */
    public function getGoverneras($load = true)
    {
        if ($this->_Governeras === null && $load) {
            $this->getMapper()->loadRelated('FkGovernerasTypegovernera1', $this);
        }

        return $this->_Governeras;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Typegovernera
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Typegovernera());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Typegovernera::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdtypegovernera() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idtypegovernera = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdtypegovernera()));
    }
}
